package aden.Generic;


public class GenGeomLine
{
	public GenGeomLine(float inX1,float inY1,float inX2,float inY2)
	{
		if (inX1 == inX2)
		{
			mIsVertical = true;
			mX = inX1;
		}
		else
		{
			mIsVertical = false;
			mA = ((float)(inY1-inY2)) / ((float)(inX1-inX2));
			mB = inY1 - inX1 * mA;
		}
	}
	
	public boolean IsPointAbove(float inX,float inY)
	{
		if (mIsVertical)
		{
			return inY == mX;
		}
		else
		{
			return (mA * inX + mB) < inY;
		}
	}
	
	// droite parametree

	private boolean mIsVertical;
	private float     mX;
	// y = Ax + B
	private float mA;
	private float mB;

	public double GetSlope()
	{
		return mA;
	}
	
	static public double CalcDist(int inX1, int inX2, int inY1, int inY2)
	{
		return 	Math.sqrt((double)((inX1 - inX2) * (inX1 - inX2) + 
				(inY1 - inY2) * (inY1 - inY2)));

	}

}